<?php
/*
 * Gallery - a web based photo album viewer and editor
 * Copyright (C) 2000-2002 Bharat Mediratta
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or (at
 * your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

// Hack prevention.
if (!empty($_REQUEST["GALLERY_BASEDIR"])) {
	print "Security violation\n";
	exit;
}

require_once("./init.php"); 
$myts =& MyTextSanitizer::getInstance();

// Hack check
if (!$gallery->user->canWriteToAlbum($gallery->album)) {
	exit;
}
	
if (isset($save)) {
	$gallery->album->fields["title"] = $myts->addSlashes($title);
	// $gallery->album->fields["bgcolor"] = $bgcolor;
	// $gallery->album->fields["textcolor"] = $textcolor;
	// $gallery->album->fields["linkcolor"] = $linkcolor;
	// $gallery->album->fields["font"] = $font;
	// $gallery->album->fields["bordercolor"] = $bordercolor;
	// $gallery->album->fields["border"] = $border;
	// $gallery->album->fields["background"] = $background;
	$gallery->album->fields["thumb_size"] = $thumb_size;
	$gallery->album->fields["resize_size"] = $resize_size;
	$gallery->album->fields["returnto"] = $returnto;
	$gallery->album->fields["rows"] = $rows;
	$gallery->album->fields["cols"] = $cols;
	$gallery->album->fields["fit_to_window"] = $fit_to_window;
	$gallery->album->fields["use_fullOnly"] = $use_fullOnly;
	$gallery->album->fields["print_photos"] = $print_photos;
	$gallery->album->fields["use_exif"] = $use_exif;
	$gallery->album->fields["display_clicks"] = $display_clicks;
	$gallery->album->fields["public_comments"] = $public_comments;
	$gallery->album->save();

	getRequestVars('setNested', false);
	if ($setNested) {
		$gallery->album->setNestedProperties();
	}

	reload();
}

?>
<html>
<head>
<title><?php echo _XG_ALBUM_PROPERTIES; ?></title>
<?php echo getStyleSheetLink() ?>
</head>
<body>
<center><?php echo _XG_ALBUM_PROPERTIES; ?>

<?php echo makeFormIntro("edit_appearance.php", 
			array("name" => "theform", 
				"method" => "POST")); ?>
<input type="hidden" name="save" value="1">
<table>
<tr>
<td><?php echo _XG_ALBUM_TITLE; ?></td>
<td><input type=text name="title" value="<?php echo $myts->htmlSpecialChars($myts->stripSlashesGPC($gallery->album->fields["title"]),1)?>"></td>
</tr>
<tr>
<td><?php echo _XG_THUMBNAIL_SIZE; ?></td>
<td><input type=text name="thumb_size" value="<?php echo $gallery->album->fields["thumb_size"]?>"></td>
</tr>
<tr>
<td><?php echo _XG_AUTO_RESIZE; ?></td>
<td><select name="resize_size"><?php echo selectOptions($gallery->album, "resize_size", array("off", 400, 500, 600, 640, 700, 800, 1024)) ?></select></td>
</tr>
<tr>
<td><?php echo _XG_SHOW_RETURN_LINK; ?></td>
<td><select name="returnto"><?php echo selectOptions($gallery->album, "returnto", array(_YES, _NO)) ?></select></td>
</tr>
<tr>
<td><?php echo _XG_ROWS; ?></td>
<td>
 <select name="rows">
  <?php echo selectOptions($gallery->album, "rows", array(1, 2, 3, 4, 5, 6, 7, 8, 9)) ?>
 </select>
</td>
</tr>
<tr>
<td><?php echo _XG_COLUMNS; ?></td>
<td>
 <select name="cols">
  <?php echo selectOptions($gallery->album, "cols", array(1, 2, 3, 4, 5, 6, 7, 8, 9)) ?>
 </select>
</td>
</tr>
<tr>
<td><?php echo _XG_AUTO_FIT_IMAGES; ?></td>
<td><select name="fit_to_window"><?php echo selectOptions($gallery->album, "fit_to_window", array(_YES, _NO)) ?></select></td>
</tr>
<tr>
<td><?php echo _XG_VISITORS_PREFERENCE_RESIZED_IMAGES; ?></td>
<td><select name="use_fullOnly"><?php echo selectOptions($gallery->album, "use_fullOnly", array(_YES, _NO)) ?></select></td>
</tr>
<tr>
<td><?php echo _XG_PHOTO_PRINTING_SERVICE; ?></td>
<td><select name="print_photos"><?php echo selectOptions($gallery->album, "print_photos", array(_XG_NONE, _XG_SHYFLYN, _XG_SHYFLYD)) ?></select></td>
</tr>
<?php
if ($gallery->app->use_exif) {
?>
<tr>
<td><?php echo _XG_DISPLAY_EXIF_DATE; ?></td>
<td><select name="use_exif"><?php echo selectOptions($gallery->album, "use_exif", array(_NO, _YES)) ?></select></td>
</tr>
<?php
} // end if
?>
<tr>
<td><?php echo _XG_DISPLAY_CLICK_COUNTER; ?></td>
<td><select name="display_clicks"><?php echo selectOptions($gallery->album, "display_clicks", array(_YES, _NO)) ?></select></td>
</tr>
<tr>
<td><?php echo _XG_ALLOW_COMMENT_PUBLIC; ?></td>
<td><select name="public_comments"><?php echo selectOptions($gallery->album, "public_comments", array(_NO, _YES)) ?></select></td>
</tr>
</table>

<br>
<input type="checkbox" name="setNested" value="1"><?php echo _XG_APPLY_VALUES_NESTED; ?>
<br>
<br>
<input type="submit" name="submit" value="<?php echo _XG_APPLY; ?>">
<input type="reset" value="<?php echo _XG_UNDO; ?>">
<input type="submit" name="submit" value="<?php echo _XG_CLOSE; ?>" onclick='parent.close()'>

</form>

<script language="javascript1.2">
<!--   
// position cursor in top form field
document.theform.title.focus();
//-->
</script>

</body>
</html>

